home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODF-Interest Archive / July 96 / Re Default Directory.2 < prev    next >
Encoding:
Internet Message Format  |  1996-07-08  |  2.0 KB  |  [TEXT/ttxt]

  1. Subject:     Re: Default Directory
  2. Sent:        7/3/96 4:59 PM
  3. Received:    7/3/96 5:01 PM
  4. From:        Henri Lamiraux, lamiraux@apple.com
  5. Reply-To:    ODF Interest, ODF-Interest@CILabs.ORG
  6. To:          OpenDoc Development Framework Discussion List, ODF-Interest@CILabs.
  7.  
  8. >Henri,
  9. >
  10. >I wrote you a couple of months ago about getting the directory of the part
  11. >editor, and you said that you would research it further. Have you found a
  12. >way to do it, yet? If so, would you post the code snippet to do so?
  13. >
  14. >Thanks in advance,
  15. >Scott
  16. >-- 
  17. >Scott Daniels             scottdfl@sprynet.com
  18. >"Life appears the way you choose to see it."
  19.  
  20. Looks like my first answer was never posted so here it is again:
  21.  
  22.  
  23. This is a bug in ODF 1. I cannot give you a fix because the bug is in the 
  24. shared library. But the following code extracted from ODF 2 should do 
  25. what you expect (I did not tested it so...)
  26.  
  27. ------------------------------
  28.  
  29. FW_OFileSpecification* fileSpec = new FW_OFileSpecification;
  30.  
  31.     FSSpec             macFileSpec;
  32.     FInfo             fileInfo;
  33.     FW_PascalChar     buffer[255];
  34.     FCBPBRec        pb;
  35.     
  36.     pb.ioFCBIndx = 0;
  37.     pb.ioVRefNum = 0;
  38.     pb.ioRefNum = gInstance->fRefNum;
  39.     pb.ioNamePtr = buffer;
  40.     OSErr err = ::PBGetFCBInfoSync(&pb);
  41.     if (err != noErr)
  42.     {
  43.         buffer[0] = 0;
  44.         pb.ioFCBVRefNum = 0;
  45.         pb.ioFCBParID = 0;
  46.     }
  47.     
  48.     ::FSMakeFSSpec(pb.ioFCBVRefNum, pb.ioFCBParID, buffer, &macFileSpec);
  49.     ::FSpGetFInfo(&macFileSpec, &fileInfo);
  50.  
  51.     fileSpec->AssignFileSpec(ev, &macFileSpec);
  52.     fileSpec->MacSetTypeAndCreator(ev, fileInfo.fdType, fileInfo.fdCreator);
  53.  
  54.     FW_PFileSpecification shLibFileSpec(ev, fileSpec);
  55.     FW_PDirectorySpecification libDir(ev, 
  56. shLibFileSpec->GetParentDirectory(ev));
  57.     FW_CString path;
  58.     libDir->GetFullPath(ev, path);
  59.  
  60.  
  61. ........................................................................
  62.  Henri Lamiraux                                      lamiraux@apple.com
  63.  Apple Computer, Inc.                 OpenDoc(tm) Development Framework
  64. ........................................................................
  65.  
  66.  
  67.